<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Database - Query Builder Delete - Fuel Documentation</title>
	<link href="../../assets/css/main.css" media="screen" rel="stylesheet" />
	<script type="text/javascript" src="../../assets/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="../../assets/js/nav.js"></script>
	<script type="text/javascript" src="../../assets/js/highlight.pack.js"></script>
	<script type="text/javascript">
		$(function() {
			show_nav('classes', '../../');
		});
		hljs.tabReplace = '    ';
		hljs.initHighlightingOnLoad();
	</script>
</head>
<body>

	<header>
		<h1>Fuel Documentation</h1>
	</header>

	<div id="main-nav"></div>

	<section id="content">
		<h2 id="introduction">Query_Builder_Delete class (extends <a href="qb_where.html">Query_Builder_Where</a></h2>
		
		<p>
			The Query_Builder_Delete class handles all the delete operations for the query building process. It extends the
			Query_Builder_Where class, so all the methods are inherrited.
		</p>
		
		<h2 id="methods">Methods</h2>

		<article>
			<h4 id="method_table">table($table)</h4>
			<p>The <strong>table</strong> method sets/changes the table to delete from.</p>
			<table class="method">
				<tbody>
					<tr>
						<th>Static</th>
						<td>No</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$table</kbd></th>
									<td><em>string</em></td>
									<td><em>required</em></td>
									<td>the table name</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>Returns the current instance.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// prepare an update statement
$query = DB::delete('users');

// Set the table to delete from
$query->table('admins');

// DELETE `admins` ...
</code></pre>
						</td>
					</tr>
				</tbody>
			</table>
		</article>
		
		<article>
			<h4 id="method_compile">compile(\Database_Connection$db)</h4>
			<p>The <strong>limit</strong> method returns the delete SQL query as a string.</p>
			<table class="method">
				<tbody>
					<tr>
						<th>Static</th>
						<td>No</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<table class="parameters">
								<tr>
									<th>Param</th>
									<th>Type</th>
									<th>Default</th>
									<th class="description">Description</th>
								</tr>
								<tr>
									<th><kbd>$db</kbd></th>
									<td><em>object</em></td>
									<td><em>required</em></td>
									<td>A database connection</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>Returns the SQL query as a string.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// prepare an update statement
$query = DB::delete('users');

// Set a where statement
$query->where('looks', 'like', '%spammer%');

// Get the database connection
$connection = Database_Connection::instance();

// Get the sql query
$sql = $query->compile($connection);

// DELETE FROM `users` WHERE `looks` LIKE "%spammer%"
</code></pre>
						</td>
					</tr>
				</tbody>
			</table>
		</article>
		
		<article>
			<h4 id="method_reset">reset()</h4>
			<p>The <strong>reset</strong> method resets all values of the current instance.</p>
			<table class="method">
				<tbody>
					<tr>
						<th>Static</th>
						<td>No</td>
					</tr>
					<tr>
						<th>Parameters</th>
						<td>
							<em>None</em>
						</td>
					</tr>
					<tr>
						<th>Returns</th>
						<td>Returns the current instance.</td>
					</tr>
					<tr>
						<th>Example</th>
						<td>
							<pre class="php"><code>// prepare an update statement
$query = DB:delete('users');

// Set a where statement
$query->where('it_look', 'ok to me');

// Reset it
$query->reset();

// Just an other where statement
$query->where('looks', 'like', '%bad mister%');

// Get the database connection
$connection = Database_Connection::instance();

// Get the sql query
$sql = $query->compile($connection);

// DELETE FROM `users` WHERE `looks` LIKE "%bad mister%"
</code></pre>
						</td>
					</tr>
				</tbody>
			</table>
		</article>
						
	</section>

	<section id="footer">
		<p>
			<a href="http://fuelphp.com">Fuel</a> is released under the MIT license.<br />
			&copy; 2010 - 2011 Fuel Development Team
		</p>
	</section>

</body>
</html>
